import Vue from 'vue';
import Router from 'vue-router';
import Home from './views/Home';


Vue.use(Router);

export default new Router({
    mode: 'history',
    routes: [

        {

            path: '/Home',
            name: 'home',
            component: Home,
            //redirect:'./Home/detail',
            children:[


            ]
        },

        {
            path: '/Booklist',
            name: 'Booklist',
            component: () => import('./views/Booklist')
        },
        {
            path: '/Recommend',
            name: 'Recommend',
            component: () => import('./views/Recommend'),
            redirect: '/Recommend/Recone',
            children: [
                {
                    path: 'Recone',
                    name: 'Recone',
                    component: () =>import('./views/children/Recone')
                },
                {
                    path: 'Rectwo',
                    name: 'Rectwo',
                    component: () =>import('./views/children/Rectwo')
                },
                {
                    path: 'Recthree',
                    name: 'Recthree',
                    component: () =>import('./views/children/Recthree')
                },
                {
                    path: 'Recfour',
                    name: 'Recfour',
                    component: () =>import('./views/children/Recfour')
                },
                {
                    path: 'Recfive',
                    name: 'Recfive',
                    component: () =>import('./views/children/Recfive')
                },
            ]
        },
        {
            path: '/Likepoeam',
            name: 'Likepoeam',
            component: () => import('./views/Likepoeam')
        },
        {
            path: '/Communication',
            name: 'Communication',
            component: () => import('./views/Communication copy')
        },
        {
            path:'/CommunChildren/:id',
            name: 'CommunChildren',
            meta:{
                login:true
            },
            component: () => import('./views/CommunChildren')
        },
        {
            path: '/Message',
            name: 'Message',
            component: () => import('./views/Message'),
            children: [
                {
                    path:':fileName',
                    component: () => import('./components/ebook/EbookReader')
                }
            ]
        },
        {
            path: '/Personalcenter',
            name: 'Personalcenter',
            component: () => import('./views/Personalcenter'),
            meta:{
                login:true
            },
            redirect: '/Personalcenter/Account',
            children: [
                {
                    path: 'detail',
                    component: () => import('./views/store/StoreDetail.vue')
                },
                {
                    path: 'list',

                    component: () => import('./views/store/StoreList.vue')
                },
                {
                    path: 'Account',
                    name: 'Account',
                    component: () =>import('./views/children/Account')
                },
                {
                    path: 'Information',
                    name: 'Information',
                    component: () =>import('./views/children/Information')
                },
                {
                    path: 'Record',
                    name: 'Record',
                    component: () =>import('./views/children/Record')
                },
            ]
        },
        {
            path: '/Adminster',
            name: 'Adminster',
            component: () => import('./views/Adminster')
        },
        {
            path: '/Zhuce',
            name: 'Zhuce',
            component: () => import('./views/Zhuce')
        },
        {
            path: 'Notfound',
            component: () => import('./views/Notfound')
        },
        {
            path:'*',
            // redirect (to) {
            //     if(to.path === '/'){
            //         return '/Home'
            //     }else{
            //         return '/Notfound'
            //     }
            // }
        }
    ]
})
